var t = getApp();

Component({
    options: {
        styleIsolation: "shared"
    },
    properties: {
        bearerList: {
            type: Array,
            value: [],
            observer: function(t) {
                this.splitBearerList(t);
            }
        },
        loading: {
            type: Boolean,
            value: !1
        },
        finshed: {
            type: Boolean,
            value: !1
        }
    },
    data: {
        isBatchOperation: !1,
        personalList: [],
        companyList: [],
        batchBearers: []
    },
    lifetimes: {
        attached: function() {
            this._initData();
        }
    },
    pageLifetimes: {
        show: function() {
            this._initData();
        }
    },
    methods: {
        _initData: function() {
            this.setData({
                isBatchOperation: !1,
                personalList: [],
                companyList: [],
                batchBearers: []
            });
        },
        splitBearerList: function(t) {
            if (!Array.isArray(t)) return !1;
            var e = t.filter(function(t) {
                return 0 == t.type;
            }), a = t.filter(function(t) {
                return 1 == t.type;
            });
            this.setData({
                personalList: this.data.personalList.concat(e),
                companyList: this.data.companyList.concat(a)
            });
        },
        selectBolfun: function() {
            this.setData({
                batchBearers: [],
                isBatchOperation: !this.data.isBatchOperation
            });
        },
        checkboxGroupChange: function(t) {
            this.setData({
                batchBearers: t.detail
            });
        },
        toggle: function(t) {
            var e = t.currentTarget.dataset.id;
            this.selectComponent(".checkbox-".concat(e)).toggle();
        },
        deleteBearers: function() {
            var e = this, a = t.getNetAddresss("plugin.invoice.frontend.rise.destory");
            t._getNetWork({
                url: a,
                data: {
                    ids: this.data.batchBearers.join(",")
                },
                success: function(a) {
                    var i = a.data;
                    t.tips(i.msg), 1 == i.result && (e._initData(), e.triggerEvent("deleteBearers"));
                }
            });
        },
        toInvoiceOperation: function(t) {
            var e = t.currentTarget.dataset.item, a = "/packageI/invoice/invoiceOperation/invoiceOperation";
            e && (a = a + "?id=" + e.id), wx.navigateTo({
                url: a
            });
        }
    }
});